/*
 * Magentoid2
 * 
 * @author	Ivica Tadić <ivica.tadic@ymail.com>
 */
package com.ivica.magentoid;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.ivica.magentoid.configuration.ds.ConfigurationDS;
import com.ivica.magentoid.core.MagentoidApp;

public class MagentoidActivity extends Activity {

	MagentoidApp mApp = MagentoidApp.getInstance();
	ProgressBar spinner;
	
	
	private static final String LOG_TAG = "Magento Store";
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		spinner = (ProgressBar) findViewById(R.id.pspinner);
		
		//new BackgroudAsyncTask().execute();
		//
		if (mApp.getConfiguration().ds == null) {
			Toast.makeText(this, "Nothing", Toast.LENGTH_LONG).show();
		} else {
			 
			Toast.makeText(this, mApp.getConfiguration().ds.getItemActions().getRelatedProductBackgroundColor(),
					Toast.LENGTH_LONG).show();
		}
		
		//spinner.setVisibility(View.GONE);
	}
	
	
	public class BackgroudAsyncTask extends AsyncTask<Void, Integer, ConfigurationDS> {
		int myProgress;
		
		protected void onPostExecute(Void result) {
			Toast.makeText(MagentoidActivity.this, "onPostExecute", Toast.LENGTH_SHORT).show();
		}
		@Override
		protected void onPreExecute() {
			Toast.makeText(MagentoidActivity.this, "onPreExecute", Toast.LENGTH_SHORT).show();
			myProgress = 0;
		}
		
		@Override
		protected ConfigurationDS doInBackground(Void... params) {
			if (mApp.getConfiguration().ds == null) {
				Toast.makeText(MagentoidActivity.this, "Nothing", Toast.LENGTH_LONG).show();
			} else {
				Toast.makeText(MagentoidActivity.this, mApp.getConfiguration().ds.getGeneral().getCopyright(),
						Toast.LENGTH_LONG).show();
			}
			return null;
		}
		@Override
		protected void onProgressUpdate(Integer... values) {
			//spinner.setProgress(values[0]);
			//setProgressbarPercen();
		}
	}
	//Debug
		public static final void logD(String paramString)
		{
			
			Log.d(LOG_TAG, paramString);
		}

		public static final void logE(String paramString)
		{
			Log.e(LOG_TAG, paramString);
		}

		public static final void logI(String paramString)
		{
			Log.i(LOG_TAG, paramString);
		}

		public static final void logV(String paramString)
		{
			Log.v(LOG_TAG, paramString);
		}

		public static final void logW(String paramString)
		{
			Log.w(LOG_TAG, paramString);
		}
}